//Fusion of the 422 Proportion
//Dustin Striplin, Tyler Simrell, Lawrence Grass, and Jacob Hall
//Finished 5/1/13

package model;

import java.util.HashMap;
/**
 * Contains all the information needed to set up the program passed from the view
 * to the controller.
 * @author Lawrence Grass
 * @version 4/28/13
 */

public class SetupInfo {
	public static final int ABSOLUTE_PAGE_LIMIT = 10000;
	
	private String seedUrl;
	
	private HashMap<String, Integer> keywordList = new HashMap<String, Integer>();
	
	private int maxParsers;
	
	private int maxRetrievers;
	
	private boolean multiThreaded;
	
	/**
	 * The maximum number of pages to retrieve in the program.  If number input by the user is
	 * greater than ABSOLUTE_PAGE_LIMIT (10000), the it defaults to that limit.  Otherwise,
	 * the user dictates this value.
	 */
	
	public int maxPagesToRetrieve;
	
	public SetupInfo(String seed,  HashMap<String, Integer> keywordlist, int maxPars,
						  int maxRetr, int maxPages, boolean multiThread){
		seedUrl = seed;
		keywordList = keywordlist;
		maxParsers = maxPars;
		maxRetrievers = maxRetr;
		if (maxPages > ABSOLUTE_PAGE_LIMIT)
		{
			maxPagesToRetrieve = ABSOLUTE_PAGE_LIMIT;
		}
		else
		{
			maxPagesToRetrieve = maxPages;
		}
		multiThreaded = multiThread;
	}
	
	public String getSeedUrl(){
		return seedUrl;
	}
	
	/**
	 * @return a copy of the keyword list
	 */
	public HashMap<String, Integer> getKeywords(){
		//this returns a shallow copy, but since String and Integer are immutable
			//this won't be a problem.
		return new HashMap<String, Integer>(keywordList);
	}
	
	public int getMaxParsers(){
		return maxParsers;
	}
	
	public int getMaxRetrievers(){
		return maxRetrievers;
	}
	
	public boolean isMultiThreaded(){
		return multiThreaded;
	}
	
	/**
	 * Returns the maximum number of pages to retrieve in the program.  If number input by the user is
	 * greater than ABSOLUTE_PAGE_LIMIT (10000), the it defaults to that limit.  Otherwise,
	 * the user dictates this value.
	 * @return maxPagesToRetrieve The maximum numbuer of pages to retrieve
	 */
	public int getPageLimit()
	{
		return maxPagesToRetrieve;
	}
}
